package com.evil.Log;

import com.evil.Data.Data;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Date;

/********************************************
 * 工程名：Web
 * 包名：com.evil.Log
 * 时间：16-9-26 下午2:28
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：初始化Log4j的目录
 ********************************************/
public class Log4j_init
{

    private String path;

    public Log4j_init()
    {
        path = this.getClass().getClassLoader().getResource("").getPath().replace("WEB-INF/classes/", "");

        try
        {
            path = URLDecoder.decode(path, "utf-8");
        }
        catch (UnsupportedEncodingException e)
        {
            e.printStackTrace();
        }

        Data.Path.setRoot(path);
        Data.Path.setWeb_inf(path + "WEB-INF/");
        Data.Path.setCalsses(path + "WEB-INF/classes/");
    }

    public void initProperty()
    {
        //System.setProperty("log.dir", "/home/evil/logs_test/");
        System.setProperty("log.dir", path + "logs");
        //System.setProperty("log.test.file", "/test/test.log");
    }


}
